#!/bin/bash

#replace filename's prefix from $1 to $2
function rename() {
list=`find . -name "${1}*"`
echo "list $list"
for file in $list
do
	echo "mv $file ${file/$1/$2}"
	mv $file ${file/$1/$2}
done
}

#substitue the content from $2 to $3 on the $1 list
function substitute() {
list=${1}
echo "list $list"
for file in $list
do
echo "vi -e -s $file"
vi -e -s $file << EOF
:%s/$2/$3/g
:wq
EOF
done
}

substitute a.txt babo love
